package gp.STL;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.JspFragment;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;
import java.io.StringWriter;

public class LowerToUpperTag extends SimpleTagSupport {
    @Override
    public void doTag() throws JspException, IOException {
        //创建一个输出流，该流可以通过其toString()方法获取到其文本形式.
        StringWriter sw = new StringWriter();
        JspFragment jspBody = this.getJspBody();
        JspWriter out = getJspContext().getOut();
        jspBody.invoke(sw);
        String s = sw.toString();
        s = s.toUpperCase();
        out.write(s);
    }
}
